#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    vector<int> twoSum(vector<int>& nums, int target) {
        unordered_map<int, int> hash;
        int n = nums.size();
        for (int i = 0; i < n; i++) {
            int new_target = target - nums[i];
            if (hash.find(new_target) != hash.end()) return { i, hash[new_target] };
            hash[nums[i]] = i;
        }
        return {};
    }
};